package com.wtone.platform.gat.images.gat.service.impl;

import cn.hutool.core.convert.Convert;
import com.wtone.platform.gat.images.gat.entity.SubscribeDB;
import com.wtone.platform.gat.images.gat.mapper.SubscribeMapper;
import com.wtone.platform.gat.images.gat.service.ISubscribeService;
import com.wtone.platform.gat.images.gat.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author: aiLin
 * @date: 2020-09-28
 * @desc: 订阅对象Service业务层处理
 */
@Service
public class SubscribeServiceImpl implements ISubscribeService
{
    @Autowired
    private SubscribeMapper subscribeMapper;

    /**
     * 查询订阅对象
     * 
     * @param id 订阅对象ID
     * @return 订阅对象
     */
    @Override
    public SubscribeDB selectSubscribeById(String id)
    {
        return subscribeMapper.selectSubscribeById(id);
    }

    /**
     * 查询订阅对象列表
     * 
     * @param subscribe 订阅对象
     * @return 订阅对象
     */
    @Override
    public List<SubscribeDB> selectSubscribeList(SubscribeDB subscribe)
    {
        return subscribeMapper.selectSubscribeList(subscribe);
    }

    /**
     * 新增订阅对象
     * 
     * @param subscribe 订阅对象
     * @return 结果
     */
    @Override
    public int insertSubscribe(SubscribeDB subscribe)
    {
        subscribe.setCreateTime(DateUtils.getNowDate());
        return subscribeMapper.insertSubscribe(subscribe);
    }

    /**
     * 修改订阅对象
     * 
     * @param subscribe 订阅对象
     * @return 结果
     */
    @Override
    public int updateSubscribe(SubscribeDB subscribe)
    {
        subscribe.setUpdateTime(DateUtils.getNowDate());
        return subscribeMapper.updateSubscribe(subscribe);
    }

    /**
     * 删除订阅对象对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSubscribeByIds(String ids)
    {
        return subscribeMapper.deleteSubscribeByIds(Convert.toStrArray(ids));
    }


    /**
     * 删除订阅对象信息
     * 
     * @param id 订阅对象ID
     * @return 结果
     */
    public int deleteSubscribeById(String id,String subscribeid)
    {
        return subscribeMapper.deleteSubscribeById(id,subscribeid);
    }
}
